package ru.jexp.rcp.supply.swtext;

import org.eclipse.swt.widgets.Composite;

import ru.jexp.rcp.supply.ResultWrapper;
import ru.jexp.ucet.kolicestvo.Edinica;

public class EdizmerCombo extends JExpCombo<Edinica>
{
	private static Edinica[] collection;

	public EdizmerCombo(Composite parent)
	{
		super(parent, 30, Edinica.class);
		setConverter(JExpConverter.TO_STRING_CONVERTER);
	}

	public final void initValues()
	{
		if (collection == null)
		{
			collection = ResultWrapper.searchList(Edinica.class).toArray(new Edinica[0]);
		}
		setValues(collection);
	}

	public static EdizmerCombo createAndFill(Composite parent)
	{
		EdizmerCombo edizmer = new EdizmerCombo(parent);
		edizmer.initValues();
		return edizmer;
	}
}
